#!/usr/bin/env python
# encoding: utf-8

import os, shutil, sys

APP_ICON_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images.xcassets/AppIcon.appiconset/'   # AppIcon
# APP_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images.xcassets/LaunchImage.launchimage/'  # 原始启动图文件
APP_ZH_Hans_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/zh-Hans.lproj/'     # 新建的启动图文件（中文）
APP_EN_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/en.lproj/'  # 新建的启动图文件（英文）
APP_zh_Hant_TW_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/zh-Hant-TW.lproj/'  # 新建的启动图文件（繁体)
APP_zh_Hant_MO_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/zh-Hant-MO.lproj/'  # 新建的启动图文件（繁体)
APP_zh_Hant_HK_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/zh-Hant-HK.lproj/'  # 新建的启动图文件（繁体)
APP_zh_Hant_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/zh-Hant.lproj/'  # 新建的启动图文件（繁体）
APP_DE_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/de.lproj/'  # 新建的启动图文件（德文）
APP_JA_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/ja.lproj/'  # 新建的启动图文件（日文)
APP_PT_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/pt-PT.lproj/'  # 新建的启动图文件（葡萄牙）
APP_FR_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/fr.lproj/'  # 新建的启动图文件（法语）
APP_ES_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/es.lproj/'  # 新建的启动图文件（西班牙）
APP_PTBR_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/pt-BR.lproj/'  # 新建的启动图文件（葡萄牙-巴西）
APP_KO_LAUNCH_IMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/LaunchImages/ko.lproj/'  # 新建的启动图文件（韩语）
APP_LaunchImage_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images.xcassets/LaunchImage.launchimage/'  # LaunchImage 启动图


APP_OEM_CHANGEIMAGE_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Images/OEMChangeImage/'  # OEM需要更改的图片
APP_SQL_PATH = '/HomeMate2_Trunk/HomeMate/Resources/SQL/'   # SQL文件

APP_ZH_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/zh-Hans.lproj/'
APP_EN_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/en.lproj/'
APP_TW_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/zh-Hant-TW.lproj/'
APP_HK_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/zh-Hant-HK.lproj/'
APP_MO_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/zh-Hant-MO.lproj/'
APP_HANT_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/zh-Hant.lproj/'
APP_BASE_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/Base.lproj/'
APP_DE_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/de.lproj/'
APP_JA_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/ja.lproj/'
APP_PT_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/pt-PT.lproj/'
APP_FR_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/fr.lproj/'
APP_ES_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/es.lproj/'
APP_PTBR_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/pt-BR.lproj/'
APP_KO_STRING_PATH = '/HomeMate2_Trunk/HomeMate/Resources/Strings/ko.lproj/'



APP_PREFIX_PATH = '/HomeMate2_Trunk/HomeMate/'

PREFIX_NAME = 'HomeMate-Prefix.pch'

INFO_PLIST_NAME = 'InfoPlist.strings'

WIDGET_ZH_DEVICE_STRING_PATH = '/HomeMate2_Trunk/Widget/Device/zh-Hans.lproj/'
WIDGET_ZH_SCENE_STRING_PATH = '/HomeMate2_Trunk/Widget/Scene/zh-Hans.lproj/'
WIDGET_ZH_SECURITY_STRING_PATH = '/HomeMate2_Trunk/Widget/Security/zh-Hans.lproj/'

WIDGET_EN_DEVICE_STRING_PATH = '/HomeMate2_Trunk/Widget/Device/en.lproj/'
WIDGET_EN_SCENE_STRING_PATH = '/HomeMate2_Trunk/Widget/Scene/en.lproj/'
WIDGET_EN_SECURITY_STRING_PATH = '/HomeMate2_Trunk/Widget/Security/en.lproj/'

WIDGET_Device_ZH_STRING = "-设备"
WIDGET_SCENE_ZH_STRING = "-情景"
WIDGET_SECURITY_ZH_STRING = "-安防"

WIDGET_Device_EN_STRING = "-Devices"
WIDGET_SCENE_EN_STRING = "-Scene"
WIDGET_SECURITY_EN_STRING = "-Security"

# 爱而福德
EFUD_ZH_APPNAME = '爱而福德智家'
EFUD_EN_APPNAME = '爱而福德智家'
EFUD_APP_NAME = 'OEM_EFUD'
EFUD_APP_SOURCE = 'OEM_EFUD'

# 智家365
HOMEMATE_ZH_APPNAME = '智家365'
HOMEMATE_EN_APPNAME = 'HomeMate'
HOMEMATE_APP_NAME = 'ZhiJia365'
HOMEMATE_APP_SOURCE = 'HomeMate'

# 橙家智能
SMARTORANGE_ZH_APPNAME = '橙家智能'
SMARTORANGE_EN_APPNAME = '橙家智能'
SMARTORANGE_APP_NAME = 'OEM_ChengJia'
SMARTORANGE_APP_SOURCE = 'OEM_ChengJia'


# 希腊 Greyer Home
SMARTGEYER_ZH_APPNAME = 'GEYER Home'
SMARTGEYER_EN_APPNAME = 'GEYER Home'
SMARTGEYER_APP_NAME = 'OEM_Geyer'
SMARTGEYER_APP_SOURCE = 'OEM_Geyer'


# 一栋 YD Home
SMARTYDHome_ZH_APPNAME = 'YD Home2'
SMARTYDHome_EN_APPNAME = 'YD Home2'
SMARTYDHome_DE_APPNAME = 'YD Home2'
SMARTYDHome_APP_NAME = 'YDHome2'
SMARTYDHome_APP_SOURCE = 'YDHome2'


# 向往
SMARTHOPE_ZH_APPNAME = '向往智家'
SMARTHOPE_EN_APPNAME = '向往智家'
SMARTHOPE_APP_NAME = 'HOPE'
SMARTHOPE_APP_SOURCE = 'HOPE'



# 瑞翔创明
SMARTChuangMing_ZH_APPNAME = '智能窗帘'
SMARTChuangMing_EN_APPNAME = 'Smart Window Covering'
SMARTChuangMing_APP_NAME = 'OEM_ChuangMing'
SMARTChuangMing_APP_SOURCE = 'OEM_ChuangMing'


# 奥科aoke
SMARTAoKe_ZH_APPNAME = 'A-OK HOME'
SMARTAoKe_EN_APPNAME = 'A-OK HOME'
SMARTAoKe_APP_NAME = 'OEM_AoKe'
SMARTAoKe_APP_SOURCE = 'OEM_AoKe'


# 大鱼
DaYu_ZH_APPNAME = '大鱼智能家居'
DaYu_ZH_HANT_APPNAME = '大魚智慧家居'
DaYu_EN_APPNAME = 'DAYULINK'
DaYu_APP_NAME = 'OEM_DaYu'
DaYu_APP_SOURCE = 'OEM_DaYu'


# 立林
SMARTLUXDOMO_ZH_APPNAME = 'Signal'
SMARTLUXDOMO_EN_APPNAME = 'Signal'
SMARTLUXDOMO_APP_NAME = 'OEM_LuxDomo'
SMARTLUXDOMO_APP_SOURCE = 'OEM_LuxDomo'



# 中鼎
SMARTL365_ZH_APPNAME = '乐享365'
SMARTL365_EN_APPNAME = '乐享365'
SMARTL365_DE_APPNAME = '乐享365'
SMARTL365_APP_NAME = 'OEM_L365'
SMARTL365_APP_SOURCE = 'OEM_L365'


# 指芯智能
SMARTFCSMARTHOME_ZH_APPNAME = '指芯智能'
SMARTFCSMARTHOME_EN_APPNAME = 'FCSmartHome'
SMARTFCSMARTHOME_DE_APPNAME = 'FCSmartHome'
SMARTFCSMARTHOME_APP_NAME = 'OEM_FCSmartHome'
SMARTFCSMARTHOME_APP_SOURCE = 'OEM_FCSmartHome'


# 沃爱沃家
SMARTWOIWOJ_ZH_APPNAME = '沃爱沃家'
SMARTWOIWOJ_EN_APPNAME = 'woiwoj'
SMARTWOIWOJ_DE_APPNAME = 'woiwoj'
SMARTWOIWOJ_APP_NAME = 'OEM_WOIWOJ'
SMARTWOIWOJ_APP_SOURCE = 'OEM_WOIWOJ'



# 品客水吧
SMARTPINWATERBA_ZH_APPNAME = '鲜活水吧'
SMARTPINWATERBA_EN_APPNAME = 'Smart Pure Water'
SMARTPINWATERBA_DE_APPNAME = 'Smart Pure Water'
SMARTPINWATERBA_APP_NAME = 'OEM_PinKe'
SMARTPINWATERBA_APP_SOURCE = 'OEM_PinKe'

#安心智家
AnXin_ZH_APPNAME = '安心智家'
AnXin_ZH_HANT_APPNAME = 'Anxhome'
AnXin_EN_APPNAME = 'Anxhome'
AnXin_APP_NAME = 'OEM_Anxin'
AnXin_APP_SOURCE = 'OEM_Anxin'

#VTi Homemate
VTiHomeMate_APPNAME = 'VTi HomeMate'
VTiHomeMate_APP_SOURCE = 'OEM_Vti'

#慧生活
Hilife_ZH_APPNAME = 'hiHome Lite'
Hilife_ZH_HANT_APPNAME = 'hiHome Lite'
Hilife_EN_APPNAME = 'hiHome Lite'
Hilife_APP_NAME = 'Hilife'
Hilife_APP_SOURCE = 'Hilife'

# 珠江智联 ZLHome
SMARTZLHome_ZH_APPNAME = '智联家'
SMARTZLHome_EN_APPNAME = 'ZhiLian Home'
SMARTZLHome_APP_NAME = 'OEM_ZLHome'
SMARTZLHome_APP_SOURCE = 'OEM_ZLHome'

# 巴基斯坦 Guardian
SMARTGuardian_ZH_APPNAME = 'Guardian IOT'
SMARTGuardian_EN_APPNAME = 'Guardian IOT'
SMARTGuardian_APP_NAME = 'OEM_Guardian'
SMARTGuardian_APP_SOURCE = 'OEM_Guardian'

# 泰国 LAMPTAN
SMARTLAMPTAN_ZH_APPNAME = 'LAMPTAN HOME'
SMARTLAMPTAN_EN_APPNAME = 'LAMPTAN HOME'
SMARTLAMPTAN_APP_NAME = 'OEM_LAMPTAN'
SMARTLAMPTAN_APP_SOURCE = 'OEM_LAMPTAN'

# 望天树
SMARTWTS_ZH_APPNAME = '望天树'
SMARTWTS_EN_APPNAME = '望天树'
SMARTWTS_APP_NAME = 'Wts'
SMARTWTS_APP_SOURCE = 'Wts'

# mumbi Plug
SMARTMUMBI_ZH_APPNAME = 'mumbi Plug'
SMARTMUMBI_EN_APPNAME = 'mumbi Plug'
SMARTMUMBI_APP_NAME = 'OEM_Mumbi'
SMARTMUMBI_APP_SOURCE = 'OEM_Mumbi'


# 好欣兴
HAOXINXING_ZH_APPNAME = '好欣兴'
HAOXINXING_EN_APPNAME = 'haoxinxing'
HAOXINXING_APP_NAME = 'OEM_Haoxinxing'
HAOXINXING_APP_SOURCE = 'OEM_Haoxinxing'

# 尔朵
Erduo_ZH_APPNAME = '尔朵之家'
Erduo_EN_APPNAME = 'Erduo home'
Erduo_APP_NAME = 'OEM_Erduo'
Erduo_APP_SOURCE = 'OEM_Erduo'

# 艾迪曼
Aidiman_ZH_APPNAME = '艾迪曼'
Aidiman_EN_APPNAME = 'Addyman'
Aidiman_APP_NAME = 'HomeMate_OEM_LianRong'
Aidiman_APP_SOURCE = 'HomeMate_OEM_LianRong'

# ATM_Home
ATMHome_ZH_APPNAME = 'ATM Home'
ATMHome_EN_APPNAME = 'ATM Home'
ATMHome_APP_NAME = 'OEM_ATM'
ATMHome_APP_SOURCE = 'OEM_ATM'

# 雷士照明
NVC_ZH_APPNAME = '雷士智能系统'
NVC_EN_APPNAME = '雷士智能系统'
NVC_APP_NAME = 'OEM_NVC'
NVC_APP_SOURCE = 'OEM_NVC'

# 欧派
OSMART_ZH_APPNAME = '欧派智慧家'
OSMART_EN_APPNAME = 'O-SMART'
OSMART_APP_NAME = 'OEM_OPPEIN'
OSMART_APP_SOURCE = 'OEM_OPPEIN'


# 九洲智慧照明
Greeble_ZH_APPNAME = '九洲智慧照明'
Greeble_EN_APPNAME = 'Greeble Smart'
Greeble_APP_NAME = 'ZhiJia365'
Greeble_APP_SOURCE = 'ZhiJia365'

# 韩国MOO
MOO_ZH_APPNAME = 'moo'
MOO_EN_APPNAME = 'moo'
MOO_APP_NAME = 'OEM_Moo'
MOO_APP_SOURCE = 'OEM_Moo'

# 韩国HK스마트홈
HKSMARTHOME_ZH_APPNAME = 'HK스마트홈'
HKSMARTHOME_EN_APPNAME = 'HK스마트홈'
HKSMARTHOME_APP_NAME = 'OEM_Korea'
HKSMARTHOME_APP_SOURCE = 'OEM_Korea'

# 乐宜嘉 乐加智能
Leyijia_ZH_APPNAME = '乐加智能'
Leyijia_EN_APPNAME = '乐加智能'
Leyijia_APP_NAME = 'OEM_Leyijia'
Leyijia_APP_SOURCE = 'OEM_Leyijia'

# 以色列S&T
ST_ZH_APPNAME = 'PURE CUBE'
ST_EN_APPNAME = 'PURE CUBE'
ST_APP_NAME = 'OEM_Gear'
ST_APP_SOURCE = 'OEM_Gear'


# Aztech Kyla
Aztech_ZH_APPNAME = 'Aztech Kyla'
Aztech_EN_APPNAME = 'Aztech Kyla'
Aztech_APP_NAME = 'OEM_Aztech'
Aztech_APP_SOURCE = 'OEM_Aztech'

# 小鱿鱼
Yooish_ZH_APPNAME = '智能家居'
Yooish_EN_APPNAME = 'Yooish'
Yooish_APP_NAME = 'OEM_Yooish'
Yooish_APP_SOURCE = 'OEM_Yooish'

# Artani ZB
Artani_ZH_APPNAME = 'Artani ZB'
Artani_EN_APPNAME = 'Artani ZB'
Artani_APP_NAME = 'OEM_Artani'
Artani_APP_SOURCE = 'OEM_Artani'


# Home Sabuy
Sabuy_ZH_APPNAME = 'Home Sabuy'
Sabuy_EN_APPNAME = 'Home Sabuy'
Sabuy_APP_NAME = 'OEM_Ananda'
Sabuy_APP_SOURCE = 'OEM_Ananda'

# Gynoid
Gynoid_ZH_APPNAME = 'Gynoid Home'
Gynoid_EN_APPNAME = 'Gynoid Home'
Gynoid_APP_NAME   = 'OEM_Gynoid'
Gynoid_APP_SOURCE = 'OEM_Gynoid'

# 北京住总
ZhuJian_ZH_APPNAME = 'BUCC Smart'
ZhuJian_EN_APPNAME = 'BUCC Smart'
ZhuJian_APP_NAME   = 'OEM_Zhujian'
ZhuJian_APP_SOURCE = 'OEM_Zhujian'

# 拉孚智家
Larfe_ZH_APPNAME = '拉孚智家'
Larfe_EN_APPNAME = '拉孚智家'
Larfe_APP_NAME   = 'OEM_Larfe'
Larfe_APP_SOURCE = 'OEM_Larfe'

# 晒得乐智家
Hisun_ZH_APPNAME = '晒得乐智家'
Hisun_EN_APPNAME = 'Hi Sun'
Hisun_APP_NAME   = 'OEM_Hisun'
Hisun_APP_SOURCE = 'OEM_Hisun'

# 郁金香智家
Tulip_ZH_APPNAME = '郁金香智家'
Tulip_EN_APPNAME = '郁金香智家'
Tulip_APP_NAME   = 'OEM_Tulip'
Tulip_APP_SOURCE = 'OEM_Tulip'

# 郁金香智家
LS_ZH_APPNAME = 'i LeS'
LS_EN_APPNAME = 'i LeS'
LS_APP_NAME   = 'OEM_LS'
LS_APP_SOURCE = 'OEM_LS'

# id.IOT
IDIOT_ZH_APPNAME = 'Indonesia IOT'
IDIOT_EN_APPNAME = 'Indonesia IOT'
IDIOT_APP_NAME   = 'OEM_idiot'
IDIOT_APP_SOURCE = 'OEM_idiot'

# Idehome
IDEHOME_ZH_APPNAME = 'Idehome'
IDEHOME_EN_APPNAME = 'Idehome'
IDEHOME_APP_NAME   = 'OEM_idemo'
IDEHOME_APP_SOURCE = 'OEM_idemo'

# LT智家
LTzhijia_ZH_APPNAME = 'LT智家'
LTzhijia_EN_APPNAME = 'LT智家'
LTzhijia_APP_NAME   = 'OEM_CQCCN'
LTzhijia_APP_SOURCE = 'OEM_CQCCN'

# HomeTouch
HomeTouch_ZH_APPNAME = 'HomeTouch LH'
HomeTouch_EN_APPNAME = 'HomeTouch LH'
HomeTouch_APP_NAME   = 'OEM_HomeTouch'
HomeTouch_APP_SOURCE = 'OEM_HomeTouch'

# 瑞邻生活
Reallink_ZH_APPNAME = '瑞邻生活'
Reallink_EN_APPNAME = 'Reallink'
Reallink_APP_NAME   = 'OEM_Reallink'
Reallink_APP_SOURCE = 'OEM_Reallink'

#  POWERMATE P2
POWERMATE_P2_ZH_APPNAME = 'powermate'
POWERMATE_P2_EN_APPNAME = 'powermate'
POWERMATE_P2_APP_NAME   = 'OEM_POWERMATE'
POWERMATE_P2_APP_SOURCE = 'OEM_POWERMATE'

#  德国 HOMENTO
HOMENTO_ZH_APPNAME = 'HOMENTO'
HOMENTO_EN_APPNAME = 'HOMENTO'
HOMENTO_APP_NAME   = 'OEM_HOMENTO'
HOMENTO_APP_SOURCE = 'OEM_HOMENTO'

def build_efud_adHoc_app(version):
    ''' 创建 efud 测试包'''
    changeToHomeMateApp()


def build_HomeMate_adHoc_app(version):
    ''' 创建 homemate 测试包'''
    changeToEfudApp()
    os.system('fastlane buildHomeMateDebugApp version:' + version)

def replace_files(originPath, targetPath):
    originPath = os.getcwd() + originPath
    targetPath = os.path.dirname(os.getcwd()) + targetPath

    if not os.path.exists(originPath) or not os.path.exists(targetPath):
        print('文件路径不存在 originPath ' + originPath + '\ntargetPath ' + targetPath)
        sys.exit(1)
    
    for root, dirs, files in os.walk(originPath, True):
        for name in files:
            print('成功替换文件： ' + originPath + name)
            shutil.copy(originPath + name, targetPath)

def replace_file(originPath, targetPath):
    originPath = os.getcwd() + originPath
    targetPath = os.path.dirname(os.getcwd()) + targetPath
    shutil.copy(originPath, targetPath)


def replace_CFBundleDisplayName(filePath, fileName, newDisplayName):
    filePath = os.path.dirname(os.getcwd()) + filePath
    with open(filePath + fileName, 'r') as f:
        with open(filePath + fileName + '.new', 'w') as n:
            for line in f.readlines():
                if 'CFBundleDisplayName' not in line:
                    n.write(line)
                else:
                    n.write('CFBundleDisplayName = "' + newDisplayName + '"' +';' + '\n')
    
    shutil.move(filePath + fileName + '.new', filePath + fileName)

def replace_AppDelegateAppName(filePath, fileName, appName):
    filePath = os.path.dirname(os.getcwd()) + filePath
    with open(filePath + fileName, 'r') as f:
        with open(filePath + fileName + '.new', 'w') as n:
            for line in f.readlines():
                if '#define HMAppName' not in line:
                    n.write(line)
                else:
                    n.write('#define HMAppName @"' + appName + '"' + '\n')

    shutil.move(filePath + fileName + '.new', filePath + fileName)

def replace_AppDelegateAppSource(filePath, fileName, appSource):
    filePath = os.path.dirname(os.getcwd()) + filePath
    with open(filePath + fileName, 'r') as f:
        with open(filePath + fileName + '.new', 'w') as n:
            for line in f.readlines():
                if '#define HMDescSourceName' not in line:
                    n.write(line)
                else:
                    n.write('#define HMDescSourceName @"' + appSource + '"' + '\n')

    shutil.move(filePath + fileName + '.new', filePath + fileName)


     

# def main():
#     build_HomeMate_adHoc_app('2.4.0')
#     # build_efud_adHoc_app('2.3.0')

# if __name__ == '__main__':
#     main()

# -------------------------------------------- 切换应用 -----------------------------------------------------------

# 切换到 智家365 App
def changeToHomeMateApp(fileName):
    # 替换 icon 、 launchimage 、登陆页logo
    replace_files('/'+fileName+'/AppIcon/', APP_ICON_PATH)
    replace_files('/'+fileName+'/Launchimage/en/', APP_EN_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/zh-Hans/', APP_ZH_Hans_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/zh-Hant/', APP_zh_Hant_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/zh-Hant-TW/', APP_zh_Hant_TW_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/de/', APP_DE_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/ja/', APP_JA_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/pt/', APP_PT_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/pt-BR/', APP_PTBR_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/ko/', APP_KO_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/es/', APP_ES_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/fr/', APP_FR_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/OEMChangeImage/', APP_OEM_CHANGEIMAGE_PATH)
    replace_files('/'+fileName+'/SQL/', APP_SQL_PATH)

    # 替换 app 名字(中英)
    replace_CFBundleDisplayName(APP_ZH_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_ZH_APPNAME)
    replace_CFBundleDisplayName(APP_EN_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)
    replace_CFBundleDisplayName(APP_TW_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_ZH_APPNAME)
    replace_CFBundleDisplayName(APP_HK_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_ZH_APPNAME)
    replace_CFBundleDisplayName(APP_MO_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_ZH_APPNAME)
    replace_CFBundleDisplayName(APP_HANT_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_ZH_APPNAME)
    replace_CFBundleDisplayName(APP_BASE_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)
    replace_CFBundleDisplayName(APP_DE_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)
    replace_CFBundleDisplayName(APP_JA_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)
    replace_CFBundleDisplayName(APP_PT_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)
    replace_CFBundleDisplayName(APP_FR_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)
    replace_CFBundleDisplayName(APP_ES_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)
    replace_CFBundleDisplayName(APP_PTBR_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)
    replace_CFBundleDisplayName(APP_KO_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME)

    APP_BASE_STRING_PATH

    # 替换 widget 名字 (中文)
    replace_CFBundleDisplayName(WIDGET_ZH_DEVICE_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_ZH_APPNAME + '-设备')
    replace_CFBundleDisplayName(WIDGET_ZH_SCENE_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_ZH_APPNAME + '-情景')
    replace_CFBundleDisplayName(WIDGET_ZH_SECURITY_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_ZH_APPNAME + '-安防')
    # 替换 widget 名字 (英文)
    replace_CFBundleDisplayName(WIDGET_EN_DEVICE_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME + WIDGET_Device_EN_STRING)
    replace_CFBundleDisplayName(WIDGET_EN_SCENE_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME + WIDGET_SCENE_EN_STRING)
    replace_CFBundleDisplayName(WIDGET_EN_SECURITY_STRING_PATH, INFO_PLIST_NAME, HOMEMATE_EN_APPNAME + WIDGET_SECURITY_EN_STRING)
    # 替换 AppName 和 Source
    replace_AppDelegateAppName(APP_PREFIX_PATH, PREFIX_NAME, HOMEMATE_APP_NAME)
    replace_AppDelegateAppSource(APP_PREFIX_PATH, PREFIX_NAME, HOMEMATE_APP_SOURCE)

    print('\33[91m 【【【【【注意！！HomeMate 有widget，注意配置！！！ 】】】】】】】\33[0m')


# hasWidget 是否有widget
def changeToOEMApp(hasWidget,fileName,App_ZH_Name,App_EN_Name,App_HANT_Name,App_HK_Name,App_MO_Name,App_DE_Name,App_JA_Name,App_PT_Name,App_PTBR_Name,App_KO_Name,App_ES_Name,App_FR_Name,App_SORCE_Name):
   
    replace_files('/'+fileName+'/OEMChangeImage/', APP_OEM_CHANGEIMAGE_PATH)
    replace_files('/'+fileName+'/SQL/', APP_SQL_PATH)
           
   # 替换 app 名字(中英)
    replace_CFBundleDisplayName(APP_ZH_STRING_PATH, INFO_PLIST_NAME, App_ZH_Name)
    replace_CFBundleDisplayName(APP_EN_STRING_PATH, INFO_PLIST_NAME, App_EN_Name)
    replace_CFBundleDisplayName(APP_TW_STRING_PATH, INFO_PLIST_NAME, App_HANT_Name)
    replace_CFBundleDisplayName(APP_HK_STRING_PATH, INFO_PLIST_NAME, App_HK_Name)
    replace_CFBundleDisplayName(APP_MO_STRING_PATH, INFO_PLIST_NAME, App_MO_Name)
    replace_CFBundleDisplayName(APP_HANT_STRING_PATH, INFO_PLIST_NAME,App_ZH_Name)
    replace_CFBundleDisplayName(APP_BASE_STRING_PATH, INFO_PLIST_NAME, App_ZH_Name)
    replace_CFBundleDisplayName(APP_DE_STRING_PATH, INFO_PLIST_NAME, App_DE_Name)
    replace_CFBundleDisplayName(APP_JA_STRING_PATH, INFO_PLIST_NAME, App_JA_Name)
    replace_CFBundleDisplayName(APP_PT_STRING_PATH, INFO_PLIST_NAME, App_PT_Name)
    replace_CFBundleDisplayName(APP_ES_STRING_PATH, INFO_PLIST_NAME, App_ES_Name)
    replace_CFBundleDisplayName(APP_FR_STRING_PATH, INFO_PLIST_NAME, App_FR_Name)
    replace_CFBundleDisplayName(APP_PTBR_STRING_PATH, INFO_PLIST_NAME, App_PTBR_Name)
    replace_CFBundleDisplayName(APP_KO_STRING_PATH, INFO_PLIST_NAME, App_KO_Name)

    
    # 替换 AppName 和 Source
    replace_AppDelegateAppName(APP_PREFIX_PATH, PREFIX_NAME, App_SORCE_Name)
    replace_AppDelegateAppSource(APP_PREFIX_PATH, PREFIX_NAME, App_SORCE_Name)
    
    # 裁剪缺失的尺寸的 icon
    didCropIconImg(fileName)
    
    # 替换 icon 和 launchimage
    replace_files('/'+fileName+'/AppIcon/', APP_ICON_PATH)
    
    replace_files('/'+fileName+'/Launchimage/en/', APP_EN_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/zh-Hans/', APP_ZH_Hans_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/zh-Hant/', APP_zh_Hant_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/zh-Hant-TW/', APP_zh_Hant_TW_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/de/', APP_DE_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/ja/', APP_JA_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/pt/', APP_PT_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/es/', APP_ES_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/fr/', APP_FR_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/pt-BR/', APP_PTBR_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/ko/', APP_KO_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/zh-Hant-MO/', APP_zh_Hant_MO_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/zh-Hant-HK/', APP_zh_Hant_HK_LAUNCH_IMAGE_PATH)
    replace_files('/'+fileName+'/Launchimage/en/',APP_LaunchImage_PATH)

    replace_files('/'+fileName+'/Launchimage/en/',APP_LaunchImage_PATH)

    if hasWidget:
       print('\33[91m 【【【【【注意！！这个OEM有widget，注意配置！！！ 】】】】】】】\33[0m')



# ---------------------------------------------------------------------------------------------------------------

def main():

    printFeature()
    # operation = input("请输入你想执行的操作 :")   
    operation = raw_input("请输入你想执行的操作 :")

    if operation == "1":
        didSelectChangeApp()

    elif operation == "2":
        didSelectBuildApp()

    elif operation == "3":
        didChangeLaunchImg()

    elif operation == "0":
        exit()
    else:
        print("选择错误，请重新选择")
        main()

# 选择了切换应用
def didSelectChangeApp():
    printOEM()
    # operation = input("请输入你想切换的应用 :")
    operation = raw_input("请输入你想切换的应用 :")

    
    if operation == "1":
        changeToHomeMateApp('homemate')

    elif operation == "2":
        changeToOEMApp(False,'oem_efud',EFUD_ZH_APPNAME,EFUD_EN_APPNAME,EFUD_EN_APPNAME,EFUD_EN_APPNAME,EFUD_EN_APPNAME,EFUD_EN_APPNAME,EFUD_EN_APPNAME,EFUD_EN_APPNAME,EFUD_EN_APPNAME,EFUD_EN_APPNAME,EFUD_APP_NAME)

    elif operation == "3":
        changeToOEMApp(False,'oem_smartorange',SMARTORANGE_ZH_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_EN_APPNAME,SMARTORANGE_APP_SOURCE)

    elif operation == "4":
        changeToOEMApp(False,'oem_geyer',SMARTGEYER_ZH_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_EN_APPNAME,SMARTGEYER_APP_SOURCE)

    elif operation == "5":
        changeToOEMApp(False,'oem_ydhome',SMARTYDHome_ZH_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_EN_APPNAME,SMARTYDHome_APP_SOURCE)

    elif operation == "6":
        changeToOEMApp(False,'oem_hope',SMARTHOPE_ZH_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_EN_APPNAME,SMARTHOPE_APP_NAME)
    elif operation == "7":

        changeToOEMApp(False,'oem_chuangming',SMARTChuangMing_ZH_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_EN_APPNAME,SMARTChuangMing_APP_NAME)

    elif operation == "8":
        changeToOEMApp(False,'oem_aoke',SMARTAoKe_ZH_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_EN_APPNAME,SMARTAoKe_APP_NAME)
    elif operation == "9":

        changeToOEMApp('oem_luxdomo',SMARTLUXDOMO_ZH_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_EN_APPNAME,SMARTLUXDOMO_APP_NAME)

    elif operation == "10":
        changeToOEMApp(False,'oem_l365',SMARTL365_ZH_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_EN_APPNAME,SMARTL365_APP_NAME)
    elif operation == "11":
        changeToOEMApp(False,'oem_fingercrystal',SMARTFCSMARTHOME_ZH_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_EN_APPNAME,SMARTFCSMARTHOME_APP_NAME)
    elif operation == "12":
        changeToOEMApp(False,'oem_woiwoj',SMARTWOIWOJ_ZH_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_EN_APPNAME,SMARTWOIWOJ_APP_NAME)
    elif operation == "13":
        changeToOEMApp(False,'oem_dayu',DaYu_ZH_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_EN_APPNAME,DaYu_APP_SOURCE)

    elif operation == "14":
        changeToOEMApp(False,'oem_pinke',SMARTPINWATERBA_ZH_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_EN_APPNAME,SMARTPINWATERBA_APP_NAME,SMARTPINWATERBA_APP_SOURCE)
    elif operation == "15":
        changeToOEMApp(False,'oem_boton','博顿智能','i-BoTon','i-BoTon','i-BoTon','i-BoTon','i-BoTon','i-BoTon','i-BoTon','i-BoTon','i-BoTon','i-BoTon','i-BoTon','OEM_BoTon')
    elif operation == "16":
        changeToOEMApp('oem_AnXin',AnXin_ZH_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_EN_APPNAME,AnXin_APP_SOURCE)

    elif operation == "17":
        changeToOEMApp(False,'oem_vtihomemate',VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APPNAME,VTiHomeMate_APP_SOURCE)
    elif operation == "18":
        changeToOEMApp(False,'oem_Hilife', Hilife_ZH_APPNAME, Hilife_EN_APPNAME,Hilife_EN_APPNAME,Hilife_EN_APPNAME, Hilife_EN_APPNAME, Hilife_EN_APPNAME, Hilife_EN_APPNAME, Hilife_EN_APPNAME, Hilife_EN_APPNAME, Hilife_EN_APPNAME, Hilife_EN_APPNAME,Hilife_EN_APPNAME,Hilife_APP_SOURCE)
    elif operation == "19": changeToOEMApp(False,'oem_zlhome',SMARTZLHome_ZH_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_EN_APPNAME,SMARTZLHome_APP_NAME)
    elif operation == "20": changeToOEMApp(False,'oem_guardian',SMARTGuardian_ZH_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_EN_APPNAME,SMARTGuardian_APP_SOURCE)
    elif operation == "21": changeToOEMApp(True,'oem_lamptan',SMARTLAMPTAN_ZH_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_EN_APPNAME,SMARTLAMPTAN_APP_SOURCE)
    elif operation == "22": changeToOEMApp(False,'oem_wts',SMARTWTS_ZH_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_EN_APPNAME,SMARTWTS_APP_SOURCE)
    elif operation == "23": changeToOEMApp(False,'oem_mumbi',SMARTMUMBI_ZH_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_EN_APPNAME,SMARTMUMBI_APP_SOURCE)
    elif operation == "24": changeToOEMApp(False,'oem_Haoxinxing',HAOXINXING_ZH_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_EN_APPNAME,HAOXINXING_APP_SOURCE)
    elif operation == "25": changeToOEMApp(False,'oem_erduo',Erduo_ZH_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_EN_APPNAME,Erduo_APP_SOURCE)
    elif operation == "26": changeToHomeMateApp('homemate_AD')
    elif operation == "27": changeToOEMApp('oem_aidiman',Aidiman_ZH_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_EN_APPNAME,Aidiman_APP_SOURCE)
    elif operation == "28": changeToOEMApp(False,'oem_AtmHome',ATMHome_ZH_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_EN_APPNAME,ATMHome_APP_SOURCE)
    elif operation == "29": changeToOEMApp('oem_nvc',NVC_ZH_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_EN_APPNAME,NVC_APP_SOURCE)
    elif operation == "30": changeToOEMApp(False,'oem_osmart',OSMART_ZH_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_EN_APPNAME,OSMART_APP_SOURCE)
    elif operation == "31": changeToOEMApp('oem_greeble',Greeble_ZH_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_EN_APPNAME,Greeble_APP_SOURCE)
    elif operation == "32": changeToOEMApp(False,'oem_moo',MOO_ZH_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_EN_APPNAME,MOO_APP_SOURCE)
    elif operation == "33": changeToOEMApp(False,'oem_leyijia',Leyijia_ZH_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_EN_APPNAME,Leyijia_APP_SOURCE)
    elif operation == "34": changeToOEMApp(False,'oem_gear',ST_ZH_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_EN_APPNAME,ST_APP_SOURCE)
    elif operation == "39":
        changeToHomeMateApp('homemate_beta')
    elif operation == "40": changeToOEMApp(False,'oem_aztech',Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_EN_APPNAME,Aztech_APP_SOURCE)
    elif operation == "41": changeToOEMApp(False,'oem_yooish',Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_EN_APPNAME,Yooish_APP_SOURCE)
    elif operation == "42":  changeToOEMApp(False,'oem_artani',Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_EN_APPNAME,Artani_APP_SOURCE)
    elif operation == "43":          changeToOEMApp(True,'oem_koera',HKSMARTHOME_ZH_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_EN_APPNAME,HKSMARTHOME_APP_SOURCE)
    elif operation == "44": changeToOEMApp(False,'oem_ananda',Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_EN_APPNAME,Sabuy_APP_SOURCE)
    elif operation == "45": changeToOEMApp(False,'oem_gynoid',Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_EN_APPNAME,Gynoid_APP_SOURCE)
    elif operation == "46": changeToOEMApp(False,'oem_zhujian',ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,Gynoid_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_EN_APPNAME,ZhuJian_APP_SOURCE)
    elif operation == "47": changeToOEMApp(False,'oem_larfe',Larfe_ZH_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_EN_APPNAME,Larfe_APP_SOURCE)
    elif operation == "48": changeToOEMApp(False,'oem_hisun',Hisun_ZH_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_EN_APPNAME,Hisun_APP_SOURCE)
    elif operation == "49": changeToOEMApp(False,'oem_tulip',Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_ZH_APPNAME,Tulip_APP_SOURCE)
    elif operation == "50": changeToOEMApp(False,'oem_ls',LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_ZH_APPNAME,LS_APP_SOURCE)
    elif operation == "51": changeToOEMApp(False,'oem_idiot',IDIOT_ZH_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_EN_APPNAME,IDIOT_APP_SOURCE)
    elif operation == "52": changeToOEMApp(False,'oem_idemo',IDEHOME_ZH_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_EN_APPNAME,IDEHOME_APP_SOURCE)
    elif operation == "53": changeToOEMApp(False,'oem_LTzhijia',LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_ZH_APPNAME,LTzhijia_APP_SOURCE)
    elif operation == "54": changeToOEMApp(False,'oem_hometouch',HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_ZH_APPNAME,HomeTouch_APP_SOURCE)
    elif operation == "55": changeToOEMApp(False,'oem_reallink',Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_ZH_APPNAME,Reallink_APP_SOURCE)
    elif operation == "56": changeToOEMApp(False,'oem_powermate_p2',POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_ZH_APPNAME,POWERMATE_P2_APP_SOURCE)
    elif operation == "57": changeToOEMApp(False,'oem_homento',HOMENTO_ZH_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_EN_APPNAME,HOMENTO_APP_SOURCE)
    
#Larfe_ZH_APPNAME
    elif operation == "0":
        exit()
    else:
        print("选择错误，请重新选择")
        didSelectChangeApp()

# 选择了打包
def didSelectBuildApp():
    print("1")

def didChangeLaunchImg():
    import copyImg
    copyImg.entryFun()

def didCropIconImg(fileName):
    import hmImageCrop
    iconList = ['20','29','40','40-1','40-2','58','58-1','60','76','80','80-1','87','120','120-1','152','167','1024']
    tmpGInstance = hmImageCrop.Graphics()
    tmpGInstance.fixed_sizeList(fileName,'180.png',iconList)


def printFeature():

    print("\n")
    print(" ----------------------------------- ")
    print("|              功能列表             |")
    print(" ----------------------------------- ")
    print("| 1.切换应用                        |")
    print("| 2.打包                            |")
    print("| 3.替换启动图                       |")
    print("| 0.退出                            |")
    print(" ----------------------------------- ")
    print("\n")

def printOEM():
    
    print("\n")
    print(" ----------------------------------- ")
    print("|              商家列表               |")
    print(" ----------------------------------- ")
    print("| 1.智家365                          |")
    print("| 2.爱而福德                          |")
    print("| 3.橙家智能                          |")
    print("| 4.希腊 Greyer Home                 |")
    print("| 5.一栋 YD Home                     |")
    print("| 6.向往 向往智能                     |")
    print("| 7.瑞翔 创明                         |")
    print("| 8.奥科 Aoke                        |")
    print("| 9.立林 Signal                      |")
    print("| 10.中鼎 L365                       |")
    print("| 11.指芯智能                         |")
    print("| 12.沃爱沃家                         |")
    print("| 13.大鱼 Dayu                       |")
    print("| 14.品客水吧                         |")
    print("| 15.博顿                            |")
    print("| 16.安心智家                         |")
    print("| 17.VTi HomeMate                    |")
    print("| 18.慧生活  Hilife                   |")
    print("| 19.智联家                           |")
    print("| 20.巴基斯坦 Guardian                |")
    print("| 21.泰国 LAMPTAN                    |")
    print("| 22.望天树                          |")
    print("| 23.mumbi Plug                     |")
    print("| 24.好欣兴                          |")
    print("| 25.尔朵                            |")
    print("| 26.智家365_广告                    |")
    print("| 27.艾迪曼                          |")
    print("| 28.ATM Home                       |")
    print("| 29.雷士智能系统                     |")
    print("| 30.欧派                            |")
    print("| 31.九洲智慧照明                     |")
    print("| 32.韩国 MOO                        |")
    print("| 33.乐宜嘉                          |")
    print("| 34.以色列S&T                       |")
    print("| 39.智家365-Beta                    |")
    print("| 40.Aztech Kyla                     |")
    print("| 41.Yooish（小鱿鱼）                 |")
    print("| 42.Artani ZB                       |")
    print("| 43.HK스마트홈                        |")
    print("| 44.Home Sabuy                     |")
    print("| 45.Gynoid Life                    |")
    print("| 46.北京住总                        |")
    print("| 47.拉孚智家                        |")
    print("| 48.晒得乐智家                      |")
    print("| 49.郁金香智家                      |")
    print("| 50.i LeS                          |")
    print("| 51.id.IOT                         |")
    print("| 52.Idehome                        |")
    print("| 53.LT智家                       |")
    print("| 54.HomeTouch                       |")
    print("| 55.Reallink                       |")
    print("| 56.Powermate_p2                       |")
    print("| 57.德国 HOMENTO                       |")
    print("| 0.退出                             |")
    print(" ----------------------------------- ")
    print("\n")



if __name__ == '__main__':
    main()
